/* Copyright ©, 2023, ECARX (Hubei) Technology Co., Ltd. All rights reserved.
 *
 * NOTICE: This file contains information which is confidential and proprietary
 * to ECARX (Hubei) Technology Co., Ltd. and/or other developers. No license to
 * any intellectual property rights contained within this file is either granted
 * or implied except as may be provided in an agreement with ECARX (Hubei)
 * Technology Co., Ltd.
 *
 * Any unauthorized copying or distribution of content from this file in whole
 * or in part is prohibited.
 */

#define LOG_TAG "PKI_HAL"
#include "PKIHal.h"
#include "utils/Errors.h"
#include <memory>

#include <hidl/HidlTransportSupport.h>

#include "PKIHalManager.h"
#include <log/log_main.h>

int main(int argc, char const *argv[]) {
  using ::android::hardware::configureRpcThreadpool;
  using ::android::hardware::joinRpcThreadpool;
  using namespace ::vendor::ecarx::xma::pki::V1_0::implementation;
  auto pkiHal = makePKIHal();
  auto service = std::make_unique<PKIHALManager>(pkiHal.get());
  // 初始化线程池
  configureRpcThreadpool(3, true);
  const ::android::status_t status = service->registerAsService();
  if (status == ::android::OK) {
    ALOGD("register pki hal as service success!!!!!");
    joinRpcThreadpool();
    return 0;
  }
  ALOGD("register pki hal as service failed!!!!!");
  return 1;
}
